
function get_query_dimension(dc)
{
	var dimension = "";
	for (var n = 0; n < dc; n++)
	{
		var id = "dimension[" + n + "]";
		if (dijit.byId(id))
		{
			if (dimension.length > 0)
				dimension += ";";
			dimension += dijit.byId(id).attr("value");
		}
	}
	return dimension;
};

Array.prototype.contains = function(element) {
	for ( var i = 0; i < this.length; i++) {
		if (this[i] == element) {
			return true;
		}
	}
	return false;
};
  
Date.prototype.format = function(format) // author: meizz
{
	var o = {
		"M+" : this.getMonth() + 1, // month
		"d+" : this.getDate(), // day
		"h+" : this.getHours(), // hour
		"m+" : this.getMinutes(), // minute
		"s+" : this.getSeconds(), // second
		"q+" : Math.floor((this.getMonth() + 3) / 3), // quarter
		"S" : this.getMilliseconds()
	// millisecond
	};
	if (/(y+)/.test(format))
		format = format.replace(RegExp.$1, (this.getFullYear() + "")
				.substr(4 - RegExp.$1.length));
	for ( var k in o)
		if (new RegExp("(" + k + ")").test(format))
			format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k]
					: ("00" + o[k]).substr(("" + o[k]).length));
	return format;
};

function getSelectedText(name){
	var obj=document.getElementById(name);
	for(var i=0;i<obj.length;i++){
	   if(obj[i].selected==true){
	    return obj[i].text; // innerText;
	   }
	}
}

function generate_passowrd(id)
{
	 var keys = "QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890";
	 var pwd = "";
	 for (var n = 0; n < 8; n++)
	 {
		 pwd += keys.charAt(Math.floor(Math.random() * keys.length));
	 }
	 document.getElementById(id).value = pwd;
}
